//
//  NavView.m
//  CommunityApp
//
//  Created by 秦乾龙 on 16/12/6.
//  Copyright © 2016年 秦乾龙. All rights reserved.
//

#import "NavView.h"
#define kScreenW [UIScreen mainScreen].bounds.size.width
#define kScreenH [UIScreen mainScreen].bounds.size.height
#define kScale   ([UIScreen mainScreen].bounds.size.width)/750
@implementation NavView

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

- (NavView*)initWithTitle:(NSString *)title LeftImage:(UIImage *)leftImage
{
    self = [super init];
//    if (!self) {
    _backView = [[UIView alloc]init];
    _backView.frame = CGRectMake(0, 0, kScreenW, self.frame.size.height);
    _backView.backgroundColor = [UIColor blackColor];
    [self addSubview:_backView];
    CGFloat btnH = 54*kScale;
        _leftBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_leftBtn setImage:leftImage forState:UIControlStateNormal];
        _leftBtn.frame = CGRectMake(30*kScale, 58*kScale-20, btnH, btnH);
        [self addSubview:_leftBtn];
    _rightBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    [_rightBtn setImage:leftImage forState:UIControlStateNormal];
    _rightBtn.frame = CGRectMake(kScreenW-170*kScale, 58*kScale-20, 170*kScale, btnH);
    
    _rightBtn.hidden = YES;
    [self addSubview:_rightBtn];
        _titleLable = [[UILabel alloc]init];
        _titleLable.text = title;
        _titleLable.textAlignment = NSTextAlignmentCenter;
        _titleLable.frame = CGRectMake(0, 0, kScreenW, 44);
        [self addSubview: _titleLable];
//    }   
    return self;
}
@end
